//
//  IMTHTTPSessionManager.h
//  INMOTION
//
//  Created by Kyle on 3/5/15.
//  Copyright (c) 2015 Inmotion. All rights reserved.
//

#import "AFHTTPSessionManager.h"

extern NSString * const IMTHTTPSessionErrorDomain;
extern NSString * const kIMTReleaseBaseUrl;
extern NSString * const kIMTDevelopmentBaseUrl;
extern NSString * const IMTUseDevelopmentRequestUrlKey;

extern const NSInteger IMTHTTPSessionManagerRequestCancelCode;
extern const NSInteger IMTHTTPSessionManagerAuthorizationFailedCode;

@interface IMTHTTPSessionManager : AFHTTPSessionManager

@property (nonatomic, copy) NSString *baseUrl;
@property (nonatomic, copy) NSString *apiUrl;
@property (nonatomic, copy) NSString *lbsUrl;
@property (nonatomic, copy) NSString *memberUrl;
@property (nonatomic, copy) NSString *languageShortString;
@property (nonatomic, assign) BOOL reloginAlertShowing;

+ (instancetype)sharedInstance;

- (void)configUrl;

- (void)cancelAllTasks;

- (NSURLSessionDataTask *)ks_POST:(NSString *)URLString
                       parameters:(id)parameters
                          success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
                          failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
- (NSURLSessionDataTask *)lbs_POST:(NSString *)URLString
                       parameters:(id)parameters
                          success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
                          failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;

- (NSURLSessionDataTask *)ks_POST:(NSString *)URLString
                       parameters:(id)parameters
        constructingBodyWithBlock:(void (^)(id<AFMultipartFormData> formData))block
                          success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
                          failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
- (NSURLSessionDataTask *)lbs_POST:(NSString *)URLString
                       parameters:(id)parameters
        constructingBodyWithBlock:(void (^)(id<AFMultipartFormData> formData))block
                          success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
                          failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;

- (NSURLSessionDataTask *)gy_POST:(NSString *)URLString
                       parameters:(id)parameters
                          success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
                          failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;

// 下载文件
- (void)LXDownloadFileFromUrl:(NSString *)url filePath:(NSString *)filePath progress:(void (^)(CGFloat progress))progress success:(void (^)(NSURL *filePath))success failure:(void (^)(NSError *error))failure;

@end
